# -*- coding: utf-8 -*-

import os

from loguru import logger


class MyLog:
    logs_dir = './logs'

    if not os.path.exists(logs_dir):
        os.makedirs(logs_dir)

    logger.add(sink=os.path.join(logs_dir, "cdss_{time}.log"),
               format="{time:YYYY-MM-DD HH:mm:ss} | {level} | {name} | {function} | {line} | {message}",
               level="INFO",
               rotation="50 MB")

    my_logger = logger

    def get_logger(self):
        return self.my_logger
